$(document).ready(function(){
	var Id=$('#pid').val();
	eventBind();
	initDatePickers();
	genDictSelect('flupCode','flup_type','1');
	genDictSelect('isFlup','flup_status','1');
	$("#nexttime").hide();
});
// 事件绑定
function eventBind(){
	$('#cancel').click(function(){
		BootstrapDialog.closeAll();
	})
	$('#save').on('click',saveApply);
}

//保存申请
function saveApply(){
	if(!$("#flupForm").validationForm()){
		return;
	}
	$.getApiClient('/flup/save').post('#flupForm').done(function(data){
			if(data.code == "0"){
				BootstrapDialog.closeAll();
				customTimeOutDialog('信息提示','保存成功',null,2000);
				pageQuery();
			}else{
				customAlertDialog(data.message, '错误提示', null, null);
			}
		});
}
//判断是否结束随访
function selectOnchang(){ 
	var next=$("#flup_status").val();
	if(next=='2'){
		$("#nexttime").show();
	}
}
